export default {
    'GET /mock/getUserInfo.jsp': (req, res) => {
        const arr = ["123", "456"],
            resArr = [];
        let num = parseInt(Math.random() * 2);
        if (num == 2) {
            num = 1;
        }
        if (num == 0) {
            let rand = parseInt(Math.random() * 2);
            if (rand == 2) {
                rand = 1;
            }
            resArr.push(arr[rand]);
        }else{
            resArr.push(arr[0]);
            resArr.push(arr[1]);
        }


        res.send({
            "code": 1,
            "msg": "获取成功",
            "id": 2,						//用户id
            "uid": "xxx",				//用户uid
            "isPlay1": 0,				//是否已参与线上抽奖,0否1是
            "isPlay2": parseInt(Math.random() * 2),				//是否已参与线下抽奖,0否1是
            "ticketIds": resArr,   //已领优惠券id数组
            "ticketNames": ["123", "456"],   //已领优惠券名称数组
        })
    },
    'POST /mock/lottery.jsp': (req, res) => {
        const arr = [{
            "code": 1,
            "msg": "恭喜中奖/未中奖",
            "isAward": 1,			//是否中奖0否1是
            "amount": parseInt(Math.random() * 10000) / 100,			//红包金额
        }, { "code": -7, "msg": "当前抢红包人数过多,请稍后再试" }, { "code": -8, "msg": "谢谢参与" }]
        let index = parseInt(Math.random() * 3);
        if (index == 3) {
            index = 2;
        }
        res.send(arr[index]);
    }
}
